Uec3.PartnerAddWindow = Ext
		.extend(
				Ext.app.Module,
				{
					id :'partner_add',
					type :'common/partnerAdd',
					paramsCollection :new Ext.util.MixedCollection(true),
					getParamsByKey : function(key) {return this.paramsCollection.get(key);},
					// 删除PartnerAddress对象
					deletePartnerAddress : function(rowIndex) {
						var partnerAddress_ds = this.getParamsByKey('partnerAddress_ds');
						var partnerAddress_grid = this.getParamsByKey('partnerAddress_grid');
						var record = partnerAddress_ds.getAt(rowIndex);
						partnerAddress_ds.remove(record);
						partnerAddress_grid.view.refresh();
					},
					getPanel : function(params) {
						var partner_dist_cmb;
						var partner_city_cmb;
						var partner_prov_cmb;
						var partnerAdress_record;
						var partnerAddress_ds;
						var partnerAddress_grid;
						var partner_win;
						var partner_form;
						var partner_storeRelation;
						var partnerAdress_storeProvince;
						var partnerAdress_storeCity;
						var partnerAdress_storeCounty;
						var partner_ajax;
						var partner_comboRelation;
						var partnerAdress_comboProvince;
						var partnerAdress_comboCity;
						var partnerAdress_comboCounty;
						
						partnerAdress_record = Ext.data.Record.create([
							{name : 'id'},
							{name : 'partnerId'},
							{name : 'areaId'},
						    {name : 'province'},
							{name : 'city'}, 
							{name : 'provinceId'}, 
							{name : 'cityId'}, 
							{name : 'district'}, 
							{name : 'street'}, 
							{name : 'postCode'}, 
							{name : 'receiverName'}, 
							{name : 'phone'},
							{name : 'mobile'
						}]);
							
						var render_partnerAddressDesc = function(value,cellmeta, record, rowIndex, columnIndex, store) {
							var str = "<a style='font-size:12px' href='javascript:Ext.CUR_APP.getModule(\"partner_add\").deletePartnerAddress("+ rowIndex + ");'>删除</a>";
						    return str;
						}

						function getAndRestorePartner(){

							partnerAdress_storeProvince = new Ext.data.Store(
									{
										proxy :new Ext.data.HttpProxy({url :Uec3.App.Constants.homeUrl + '/area/toSelect.do'}),
										reader :new Ext.data.JsonReader( {root :'areas'}, [ {name :'id'}, {name :'province'}])
									});

							partnerAdress_storeCity = new Ext.data.Store(
									{
										proxy :new Ext.data.HttpProxy({url :Uec3.App.Constants.homeUrl + '/area/toSelect.do'}),
										reader :new Ext.data.JsonReader( {root :'areas'}, [ {name :'id'}, {name :'city'}])
									});

							partnerAdress_storeCounty = new Ext.data.Store(
									{
										proxy :new Ext.data.HttpProxy({url :Uec3.App.Constants.homeUrl + '/area/toSelect.do'}),
										reader :new Ext.data.JsonReader( {root :'areas'}, [ {name :'id'}, {name :'district'}])
									});

							partner_storeRelation = new Ext.data.Store(
									{
										proxy :new Ext.data.HttpProxy({url :Uec3.App.Constants.homeUrl + '/dictionary/findByVarGroup.do?group=partner_relation'}),
										autoLoad :true,
										reader :new Ext.data.JsonReader( {root :'',fields : [ {name :'varIndex'}, {name :'varName'}]})
									});

							partner_storeRelation.load({
								callback : function(recs) {partner_storeRelation.remove(recs[params.partner_index]);}
							});
									
							partnerAddress_ds = new Ext.data.Store({
								proxy : new Ext.data.HttpProxy({url : Uec3.App.Constants.homeUrl+ '/partnerAddress/query_partnerAddress!query.do'}),
								pruneModifiedRecords : true,
								reader : new Ext.data.JsonReader({root : 'root'}, partnerAdress_record
								),
								// 默认排序字段
								sortInfo : {field : "id",direction : "asc"}
							});
						}

						function componentInitsPartner() {
							var formReader = new Ext.data.JsonReader(

									{root : 'root'
											}, [
												{name : 'companyId',type : 'int'}, 
												{name : 'email',type : 'string'},
												{name : 'name',type : 'string'}, 
												{name : 'contactorIdentityCode',type : 'string'}, 
												{name : 'fax',type : 'string'},
												{name : 'invoicAddress',type : 'string'}, 
												{name : 'bankName',type : 'string'},
												{name : 'bankCode',type : 'string'},
												{name : 'address',type : 'string'},
											    {name : 'qq',type : 'string'},
												{name : 'msn',type : 'string'},
												{name : 'web',type : 'string'}, 
												{name : 'contactor',type : 'string'},
												{name : 'taxCode',type : 'string'},
												{name : 'areaId',type : 'int'}, 
												{name : 'code',type : 'string'}, 
												{name : 'simpleName',type : 'string'},
												{name : 'nameEn',type : 'string'},
												{name : 'business',type : 'string'},
											    {name : 'postcode',type : 'string'},
											    {name : 'tel',type : 'string'
													}]
									);							
							// 区县下拉框
							partner_dist_cmb = getDistrictCombox(Uec3.App.Constants.homeUrl);
							partner_dist_cmb.setWidth(100);
							// 城市下拉框
							partner_city_cmb = getCityCombox(Uec3.App.Constants.homeUrl,partner_dist_cmb);
							partner_city_cmb.setWidth(100);
							// 省份下拉框
							partner_prov_cmb = getProvinceCombox(Uec3.App.Constants.homeUrl,partner_city_cmb, partner_dist_cmb);
							partner_prov_cmb.setWidth(100);		
							partnerAdress_comboProvince = new Ext.form.ComboBox(
									{
										name :'province',
										store :partnerAdress_storeProvince,
										fieldLabel :'省份',
										emptyText :'--请选择--',
										mode :'local',
										triggerAction :'all',
										valueField :'province',
										displayField :'province',
										forceSelection :true,
										selectOnFocus :true,
										typeAhead :true,
										loadingText :'加载中...',
										editable :false

									});

							partnerAdress_storeProvince.load();

							partnerAdress_comboCity = new Ext.form.ComboBox( {
								name :'city',
								store :partnerAdress_storeCity,
								fieldLabel :'城市',
								emptyText :'--请选择--',
								mode :'local',
								triggerAction :'all',
								forceSelection :true,
								valueField :'city',
								displayField :'city',
								loadingText :'加载中...',
								editable :false

							});

							partnerAdress_comboCounty = new Ext.form.ComboBox( {
								name :'district',
								fieldLabel :'地区',
								store :partnerAdress_storeCounty,
								emptyText :'--请选择--',
								mode :'local',
								triggerAction :'all',
								forceSelection :true,
								valueField :'district',
								displayField :'district',
								loadingText :'加载中...',
								editable :false
							})

							partner_comboRelation = new Ext.form.ComboBox( {
								// dataIndex:'relation',
								hiddenName :'relation',
								fieldLabel :'往来关系(*)',
								store :partner_storeRelation,
								forceSelection :true,
								emptyText :'--请选择--',
								mode :'local',
								triggerAction :'all',
								valueField :'varIndex',
								displayField :'varName',
								loadingText :'加载中...',
								editable :false,
								allowBlank :false,
								anchor :'96%',
								blankText :"往来关系不能为空"
							});

							// 列模型对象
							var partnerAddress_colModel = new Ext.grid.ColumnModel(
									[
											new Ext.grid.RowNumberer(),

											{header :"操作",width :80,dataIndex :'desc',renderer :render_partnerAddressDesc},
											{header :"省份",width :80,sortable :true,dataIndex :'province',editor :partnerAdress_comboProvince},
											{header :"城市",width :80,sortable :true,dataIndex :'city',editor :partnerAdress_comboCity},
											{header :"区域",width :80,sortable :true,dataIndex :'district',editor :partnerAdress_comboCounty	},
											{header :"详细地址",width :80,sortable :true,dataIndex :'street',editor :new Ext.grid.GridEditor(new Ext.form.TextField({}))},
											{header :"邮编",width :80,sortable :true,dataIndex :'postCode',editor :new Ext.grid.GridEditor(new Ext.form.TextField({}))},
											{header :"收货人姓名",width :100,sortable :true,dataIndex :'receiverName',editor :new Ext.grid.GridEditor(new Ext.form.TextField({}))},
											{header :"电话",width :80,sortable :true,dataIndex :'phone',editor :new Ext.grid.GridEditor(new Ext.form.TextField({}))},
											{header :"手机",width :60,sortable :true,dataIndex :'mobile',editor :new Ext.grid.GridEditor(new Ext.form.TextField({}))}
									]);

							// 初始化 partnerAddress表格对象
							partnerAddress_grid = new Ext.grid.EditorGridPanel({
								disableSelection : true,
								id : 'partnerAddressGrid',
								store : partnerAddress_ds,
								height:1,
								cm : partnerAddress_colModel,
								viewConfig : {forceFit : true,columnsText : '显示的列',scrollOffset : 30,sortAscText : '升序',sortDescText : '降序'},
								selModel : new Ext.grid.RowSelectionModel({moveEditorOnEnter : true,singleSelect : true}),
								iconCls : 'icon-grid',loadMask : {msg : '数据加载中...'},
								stripeRows : true,
								autoScroll : true,
								clicksToEdit : 1,
								tbar : new Ext.Toolbar(['-', {
											text : '增加客户收货地址',
											icon : Uec3.App.Constants.deskUrl
													+ "/resources/images/default/dd/drop-add.gif",
											handler : function() {
												var p = new partnerAdress_record({province : '',city : '',district : '',street : '',postCode : '',receiverName : '',phone : '',mobile : ''});
												partnerAddress_grid.stopEditing();
												//partnerAddress_ds.insert(0,p);
												partnerAddress_ds.addSorted(p);
												partnerAddress_grid.getView().refresh();
												partnerAddress_grid.startEditing(0, 0);
										  }
										},'-'])
							});
							var panel = new Ext.Panel({height :135,layout :'fit',items : [ partnerAddress_grid ]});
							partner_ajax = new Ext.data.Connection();
							partner_form = new Ext.form.FormPanel(
							{border :false,frame :true,height :250,reader:formReader,
							items : [{
							xtype : 'fieldset',title : '基本信息',height : 145,collapsed : false,
							items : [{
								layout : 'column',
								items : [{
									columnWidth : 0.5,
									items : [{layout : 'form',labelWidth : 70,
						            items : [
									{name : 'id',fieldLabel : '客户ID',xtype : 'hidden'}, 
									{name : 'companyId',fieldLabel : '公司ID',xtype : 'hidden'}, 
									{name : 'ownerId',fieldLabel : '拥有者ID',xtype : 'hidden'},
									{name : 'areaId',fieldLabel : '地区ID',xtype : 'hidden'},
									{xtype : 'textfield',fieldLabel : '公司名称(*)',
									name : 'name',anchor : '96%',												
									allowBlank : false,blankText : "往来单位名称不允许为空",
									maxLength:"30",maxLengthText:"最大长度为30位"}]
							}, {
								layout : 'column',
								items : [{
									columnWidth : 0.5,
									items : [{
										layout : 'form',labelWidth : 70,
										items : [{xtype : 'textfield',fieldLabel : '负责人/法人',name : 'contactor',anchor : '96%',maxLength:"30",maxLengthText:"最大长度为30位"}]
									}]
								}, {
									columnWidth : 0.5,
									items : [{
										layout : 'form',labelAlign : 'right',
										labelWidth : 70,
										items : [{
											xtype : 'textfield',fieldLabel : '法人身份证',name : 'contactorIdentityCode',anchor : '96%',
											vtype:"alphanum",alphanumText:"只能输入数字或者字符",maxLength:"30",maxLengthText:"最大长度为30位"
										}]
									}]
								}]
							}, {
								layout : 'column',
								items : [{
									columnWidth : 0.5,
									items : [{
										layout : 'form',labelWidth : 70,
										items : [{layout : 'form',labelWidth : 70,items : [partner_comboRelation]}]
									}]
								}, {
									columnWidth : 0.5,
									items : [{
										layout : 'form',labelAlign : 'right',labelWidth : 70,
										items : [{xtype : 'textfield',fieldLabel : '折扣',name : 'discount',anchor : '96%',
										maxLength:"30",maxLengthText:"最大长度为30位",regex : /^[0-9]+$/,regexText : '请输入阿拉伯数字格式'}]
									}]
								}]
							}, {
								layout : 'column',
								items : [{
									columnWidth : 0.5,
									items : [{
										layout : 'form',labelWidth : 70,
										items : [{
											layout : 'form',labelWidth : 70,
											items : [{
												xtype : 'numberfield',name : 'unpaid',fieldLabel : '应付款',readOnly : true,style : {background : '#dddddd'},anchor : '96%'
											}]
										}]
									}]
								}, {
									columnWidth : 0.5,
									items : [{
										layout : 'form',labelAlign : 'right',labelWidth : 70,
										items : [{xtype : 'numberfield',name : 'paid',fieldLabel : '已付款',readOnly : true,style : {background : '#dddddd'},anchor : '96%'}]
									}]
								}]
							}]
				}, {
					columnWidth : 0.5,
					items : [{
								layout : 'form',labelWidth : 56,labelAlign : 'right',
								items : [{xtype : 'textfield',fieldLabel : '经营项目',name : 'business',anchor : '96%',maxLength:"30",maxLengthText:"最大长度为30位"}]
							}, {
								layout : 'column',
								items : [{
									columnWidth : 0.5,
									items : [{
										layout : 'form',labelAlign : 'right',labelWidth : 56,
										items : [{
													xtype : 'textfield',fieldLabel : '税号',name : 'taxCode',anchor : '96%',
													maxLength:"30",maxLengthText:"最大长度为30位",regex : /^[0-9]+$/,regexText : '请输入阿拉伯数字格式',allowNegative:false
												}]
									}]
								}, {
									columnWidth : 0.5,
									items : [{
										layout : 'form',labelWidth : 70,labelAlign : 'right',
										items : [{
													xtype : 'textfield',fieldLabel : '工商注册码',name : 'code',anchor : '96%',allowNegative:false,maxLength:"30",
													regex : /^[0-9]+$/, regexText : '请输入阿拉伯数字格式',maxLengthText:"最大长度为30位"
												}]
									}]
								}]
							}, {
								style : "margin-left:20px;height:26px;color:#cc6699",columnWidth : 0.5, 
								items : []
							}, {
								layout : 'column',
								items : [{
									columnWidth : 0.5,
									items : [{
										layout : 'form',labelAlign : 'right',labelWidth : 56,
										items : [{xtype : 'numberfield',name : 'unreceived',fieldLabel : '应收款',readOnly : true,style : {background : '#dddddd'},anchor : '96%',allowNegative:false}]
									}]
								}, {
									columnWidth : 0.5,
									items : [{
										layout : 'form',
										labelWidth : 70,
										labelAlign : 'right',
										items : [{xtype : 'numberfield',name : 'received',fieldLabel : '已收款',readOnly : true,style : {background : '#dddddd'},anchor : '96%'}]
									}]
								}]
							}]
				}]
			}]
		}, {
			xtype : 'fieldset',title : '联系方式',height : 115,
			items : [{
				layout : 'column',
				items : [
					      {columnWidth : 0.2,
					        items : [{layout : 'form',labelWidth : 70,items : [partner_prov_cmb]}]
						}, 
						  {
							columnWidth : 0.15,
							items : [{layout : 'form',labelWidth : 30,items : [partner_city_cmb]}]
						},
						  {columnWidth : 0.15,
							items : [{layout : 'form',labelWidth : 30,items : [partner_dist_cmb]}]
						}, 
						  {
							columnWidth : 0.25,
							items : [
						            {layout : 'form',labelWidth : 56,labelAlign : 'right',
									items : [{xtype : 'textfield',fieldLabel : '通讯地址',name : 'address',anchor : '96%',maxLength:"30",maxLengthText:"最大长度为30位"}]
									}]
						},
						  {
							columnWidth : 0.25,
							items : [
								    {layout : 'form',labelWidth : 70,labelAlign : 'right',
									items : [{xtype : 'textfield',fieldLabel : '邮编',name : 'postcode',anchor : '96%',allowNegative:false,maxLength:"6",maxLengthText:"邮编最大长度不超过6个字符"}]
									}]
						}]
			}, {
				layout : 'column',
				items : [{
							columnWidth : 0.25,
							items : [
								    {layout : 'form',labelWidth : 70,
										items : [{xtype : 'textfield',fieldLabel : '开户行',name : 'bankName',anchor : '96%',maxLength:"30",maxLengthText:"最大长度为30位"}]
								},
									{
										layout : 'form',labelWidth : 70,
										items : [{xtype : 'textfield',fieldLabel : '联系电话',name : 'tel',anchor : '96%',maxLength:"30",maxLengthText:"最大长度为30位"}]
									}]
					   },{
							columnWidth : 0.25,
							items : [{
										layout : 'form',labelWidth : 70,labelAlign : 'right',
										items : [{
													xtype : 'textfield',fieldLabel : '银行账号',name : 'bankCode',anchor : '96%',allowNegative:false,
													regex : /^[0-9]+$/,regexText : '请输入阿拉伯数字格式',maxLength:"30",maxLengthText:"最大长度为30位"
											}]
									    },
									{
										layout : 'form',labelWidth : 70,labelAlign : 'right',
										items : [{xtype : 'textfield',fieldLabel : '传真电话',name : 'fax',anchor : '96%',maxLength:"30",maxLengthText:"最大长度为30位"}]
									}]
					  },{
							columnWidth : 0.5,
							items : [
								{
									    layout : 'form',labelWidth : 56,labelAlign : 'right',
										items : [{xtype : 'textfield',fieldLabel : '发票地址',name : 'invoicAddress',anchor : '96%',maxLength:"30",maxLengthText:"最大长度为30位"}]
					  },{
									   layout : 'column',
										items : [
								   {
											columnWidth : .5,
											items : [{
												layout : 'form',labelWidth : 56,labelAlign : 'right',
												items : [{xtype : 'textfield',fieldLabel : 'QQ',name : 'qq',anchor : '96%',allowNegative:false,regex : /^[0-9]+$/,regexText : '请输入阿拉伯数字格式',
												maxLength:"30",maxLengthText:"最大长度为30位"}
												]
											}]
										},
									{
											columnWidth : .5,
											items : [{
												layout : 'form',labelWidth : 70,labelAlign : 'right',
												items : [{xtype : 'textfield',fieldLabel : 'E-Mail',name : 'email',anchor : '96%',maxLength:"30",maxLengthText:"最大长度为30位"}]
											}]
										}
									]
								}]
						}]
			}]
		},panel]
					});
                          if(params.companyId){
							// 加载form表单数据
                        	  partner_form.getForm().load({
							  url : Uec3.App.Constants.homeUrl+ '/company/query_company!querySimpleCompany.do',
							  params: {companyId : params.companyId},	
                        	  method : "post",
							  waitMsg : '正在加载数据...'									
							});}							
						}
						function controlPartnerEvent() {
							partner_form.getForm().on('actioncomplete', function(form) {				
								    partner_form.ownerCt.buttons[4].hide();							
							        form.findField("code").setReadOnly(true); 
									form.findField("taxCode").setReadOnly(true);
									form.findField("contactorIdentityCode").setReadOnly(true);
									form.findField("name").setReadOnly(true);
									form.findField("contactorIdentityCode").setReadOnly(true);
									form.findField("contactor").setReadOnly(true);
									form.findField("business").setReadOnly(true);
								
						    var rootFirstValue=form.reader.jsonData.root;												
							partner_prov_cmb.setRawValue(rootFirstValue.province);
							partner_city_cmb.setRawValue(rootFirstValue.city);
							partner_dist_cmb.setRawValue(rootFirstValue.district);
							if (rootFirstValue.province != "") {
								partner_city_cmb.getStore().setBaseParam("prov",rootFirstValue.provinceId);
								partner_city_cmb.getStore().load();
							}
							if (rootFirstValue.city!= "") {
								partner_dist_cmb.getStore().setBaseParam("city",rootFirstValue.cityId);
								partner_dist_cmb.getStore().load();
							}
						});		
							partnerAdress_comboProvince.on('select', function(comboBox, record) {
								var value = record.get("id");
								var selection = partnerAddress_grid.getSelectionModel().getSelected();
								if (selection.get("provinceId") != value) {
									selection.set("provinceId", value);
									selection.set("areaId", value);
									selection.set("city", "");
									selection.set("district", "");
								}
						});

							partnerAdress_comboCity.on('beforeshow',function(comboBox) {

												var selection = partnerAddress_grid.getSelectionModel().getSelected();
												var provinceId = selection.get('provinceId');
												var lastProviceId = comboBox.getStore().baseParams.prov;
												if (lastProviceId != provinceId) {
													partnerAdress_comboCity.clearValue();
													partnerAdress_storeCity.removeAll();
													partnerAdress_storeCity.baseParams.prov = provinceId;
													partnerAdress_storeCity.load();
												}
											})

							partnerAdress_comboCounty.on('beforeshow',function(comboBox) {
												var selection = partnerAddress_grid.getSelectionModel().getSelected();
												var cityId = selection.get('cityId');
												var lastCityId = comboBox.getStore().baseParams.city;
												if (lastCityId != cityId) {
													partnerAdress_comboCounty.clearValue();
													partnerAdress_storeCounty.removeAll();
													partnerAdress_storeCounty.baseParams.city = cityId;
													partnerAdress_storeCounty.load();
												}
											})

							partnerAdress_comboCity.on('select', function(comboBox, record) {
								var value = record.get('id');
								var selection = partnerAddress_grid.getSelectionModel().getSelected();
								if (selection.get("cityId") != value) {selection.set("areaId", value);selection.set("cityId", value);selection.set("district", "");}
							});
							
							partnerAdress_comboCounty.on('select', function(comboBox, record) {var selection = partnerAddress_grid.getSelectionModel().getSelected();selection.set("areaId", record.get('id'));})

							partner_ajax.on('beforerequest', function() {Ext.MessageBox.wait("保存数据中...", "提示");});
							
							partner_ajax.on('requestcomplete', function() {Ext.MessageBox.hide();});
							
							partner_prov_cmb.on('select', function(combo) {var value = combo.getValue();partner_form.getForm().findField("areaId").setValue(value);});
							
							partner_city_cmb.on('select', function(combo) {var value = combo.getValue();partner_form.getForm().findField("areaId").setValue(value);});
							
							partner_dist_cmb.on('select', function(combo) {var value = combo.getValue();partner_form.getForm().findField("areaId").setValue(value);});
                           partnerAddress_grid.on("afteredit",function(e){
					       if(e.record.get("postCode").length>6){Ext.MessageBox.alert("错误提示","邮编最大长度不超过6个字符",function(){partnerAddress_ds.rejectChanges();})};
					       if(e.record.get("receiverName").length>30){Ext.MessageBox.alert("错误提示","接收人姓名最大长度不超过30个字符",function(){partnerAddress_ds.rejectChanges();})};
					       if(e.record.get("phone").length>30){Ext.MessageBox.alert("错误提示","电话号码最大长度不超过30个字符",function(){partnerAddress_ds.rejectChanges();})}
					       if(e.record.get("mobile").length>30){Ext.MessageBox.alert("错误提示","手机号码最大长度不超过30个字符",function(){partnerAddress_ds.rejectChanges();})}
					    },this)	
						}

						getAndRestorePartner();

						componentInitsPartner();

						controlPartnerEvent();
						this.paramsCollection.add("partner_form", partner_form);
						this.paramsCollection.add("partner_ajax", partner_ajax);
						this.paramsCollection.add("partnerAddress_ds",partnerAddress_ds);
						this.paramsCollection.add("partnerAddress_grid",partnerAddress_grid);
						return partner_form;
					},
					createWindow : function(params) {
						var desktop = this.app.getDesktop();
						var module = this;
						var partner_win = desktop.getWindow("partner_add");
						if (!partner_win) {
							partner_win = desktop
									.createWindow( {
										id :"partner_add",title :'客户增加',layout :'fit',
										constraitHeader :true,width :1000,height :520,collapsible :true,constrait :true,
										modal :true,draggable :true,plain :true,
									    maximizable : false,minimizable : false,resizable :false,
										items : [ this.getPanel(params) ],
										buttons : [
												{style :"margin-right:25px",width :200,iconCls :"icon-save",text :'该客户通过认证',disabled :true,disabledClass :"",hidden :true},
												{style :"margin-right:25px;",width :200,iconCls :"icon-close",text :'该客户未通过认证',disabled :true,disabledClass :"",hidden :true},
												{
													text :'请求查看客户详细信息',hidden :true,
													handler : function() {
														var partner_form = module.getParamsByKey("partner_form");
														var companyId = partner_form.getForm().findField("companyId").getValue();
														if (companyId == 0|| companyId == "") {Ext.Msg.alert("提示","请先点击检查认证按钮,确认对方已是认证公司,才能进行这步操作"); return;}
														partner_ajax.request( {
																	url :Uec3.App.Constants.homeUrl + '/partner/query_partner!sendNotice.do',
																	success : function(res) {
																		var result = Ext.decode(res.responseText);
																		if (result.success == "OK") {Ext.Msg.alert("提示","发送消息成功");} 
																		else {Ext.Msg.alert("提示",result.failure);}
																	},
																    failure : function(res) {Ext.Msg.alert('失败',"网络出现异常,请重先连接");},
																	params : {receiverId :companyId}
																});
													}
												},
												{
													iconCls :"",text :'查看客户信息',hidden :true,
													handler : function() {
														var partner_form = module.getParamsByKey("partner_form");
														var companyId = partner_form.getForm().findField("companyId").getValue();
														var id = partner_form.getForm().findField("id").getValue();
														var desktop = Uec3.App.getDesktop();
														desktop.launchWindowByParam("simpleCompanyMessage",{partnerId :id,id :companyId,isHiddenButton :true});}
												    },
												{
													text :'检查客户是否认证',hidden:true,
													handler : function() {
														var partner_form = module.getParamsByKey("partner_form");
														var id = partner_form.getForm().findField("id").getValue();
														if (!id) {Ext.Msg.alert("提示","请先点击增加按钮,增加客户后才能进行这步操作");return;}
														var desktop = Uec3.App.getDesktop();
														desktop.launchWindowByParam("checkIsCertify",{id :id,winId :id,partner_win :partner_win});}
												    },
												{
													text :'增加',
													handler : function() {
													var partner_form = module.getParamsByKey("partner_form");						
													var partner_ajax = module.getParamsByKey("partner_ajax");
													var partnerAddress_ds = module.getParamsByKey("partnerAddress_ds");	
														if (!partner_form.getForm().isValid()) {Ext.Msg.alert("提示","请填写必须项");return;}
														var formValues = partner_form.getForm().getValues();
														var jsonArray = [];
														var partner_json = [];
														Ext.each(partnerAddress_ds.getRange(),function(item) {jsonArray.push(item.data);});
														partner_json.push(formValues);
														partner_json.push(jsonArray);
														var jsonAll = Ext.encode(partner_json);
														var text=partner_win.buttons[5].getText();
														if(text=="增加"){					  
															partner_form.getForm().findField('id').setValue('');
															partner_form.getForm().findField('areaId').setValue('');
															partner_form.getForm().findField('ownerId').setValue('');
															partnerAddress_ds.removeAll();					  											  	
														}	
														partner_ajax.request( {
																	url :Uec3.App.Constants.homeUrl + '/partner/query_partner!save.do',
																	success : function(res) {
																	var result = Ext.decode(res.responseText);
																		if (result.success == "OK") {
																			if (result.partner.id) {
																				partner_form.getForm().findField("id").setValue(result.partner.id);						
																				partner_form.getForm().findField("areaId").setValue(result.partner.areaId);										
																				if(text=="增加"){}																				  
																				  //如果是增加客户,重新去加载客户地址
																				partnerAddress_ds.baseParams = {partnerId : result.partner.id};
										                                        partnerAddress_ds.load();
																				if(params.partner_ds){var partner_ds = params.partner_ds;partner_ds.reload();}																				  
																				partner_win.buttons[5].setText('更新');			
																			}
																			/**
																			 * ycf
																			 */
																			var rec_data = {}; rec_data.data = {};
																			for(var i in result.partner) {rec_data.data[i] = result.partner[i];}
																			if(partner_win.lookup.lookupCallBackEvents) {
																				module.setLookupValue(result.partner, partner_win);
																				partner_win.lookup.fireEvent('lookupChange', rec_data);
																			} else {partner_win.lookup.fireEvent('lookupChange', rec_data, module, partner_win.lookup.getValue(), partner_win);}
																			        partner_win.close();} else {Ext.Msg.alert("提示",result.failure);}},
																	failure : function(res) {Ext.Msg.alert('失败',"网络出现异常,请重先连接");},params : {queryParam :jsonAll}});
													           }
												}, {text :'关闭',handler : function() {partner_win.close();}}],
										 buttonAlign :'center'
									});
						}
						formBingingKeys(partner_win.items.get(0),partner_win);
						partner_win.show();
					}
				});